/* test recursive data structures with function call as return value
 */
struct list
{
  int data;
  struct list * next;
};

/*@*/
struct list * search(struct list* head, int data)
{
  struct list * p;
  p=head;
  while(p!=null&&(p->data!=data))/*p!=null&&(p->data)!=data*/
  {
    p=p->next;
  }
  return p;
}
/*@ */


/*@*/
void main()
{
  struct list *head,test;
  struct list *p;
  struct list *q;
  int i;
  i=0;
  head=alloc(struct list);
  head->next=null;
  head->data=-1;
  p=head;
  q=head;
  while ( i<10)/*@i>=0 && i<10*/
  {
    p= alloc(struct list);
    p->data=i*i;
    print(p->data);
    p->next=null;
    q->next=p;
    q=p;
    i=i+1;
  }
  p=head;
  p=search(head,16);
  print(p->data);
  return;
}
/*@*/
	

